home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AOL File Library: 2,801 to 2,900
/
aol-file-protocol-4400-2801-to-2900.zip
/
AOLDLs
/
C++ Files Library
/
Direct Blitting in C++
/
Blitting.sit
/
Blitting ƒ
/
CDirectGWorld.cp
< prev
next >
Wrap
Text File
|
1995-04-15
|
2KB
|
81 lines
// CDirectGWorld.cp, the CDirectGWorld class methods
//
// Copyright ⌐ 1995, Macneil Shonle. All rights reserved.
#ifndef __CDIRECTGWORLD__
#include <CDirectGWorld.h>
#endif
#ifndef __PIXELTYPES__
#include <PixelTypes.h>
#endif
#ifndef __QDOFFSCREEN__
#include <QDOffscreen.h>
#endif
CDirectGWorld::CDirectGWorld( Rect &bounds, BitDepth depth, CTabHandle cTable )
{ this->construct( bounds, depth, cTable );
}
CDirectGWorld::CDirectGWorld( RowWidth width, ColumnHeight height, BitDepth depth,
CTabHandle cTable )
{ Rect bounds = {0, 0, height, width};
this->construct( bounds, depth, cTable );
}
CDirectGWorld::~CDirectGWorld()
{ DestroyQuickRow();
if( mGWorld )
::DisposeGWorld( mGWorld );
}
GWorldPtr CDirectGWorld::GetMacGWorld()
{ return mGWorld;
}
void CDirectGWorld::construct( Rect &bounds, BitDepth depth, CTabHandle cTable )
{ QDErr err = NewCleanGWorld( mGWorld, bounds, depth, cTable );
if( err )
::DebugStr( "\pPrimitive Error Checking" );
PixMapHandle thePix = ::GetGWorldPixMap( mGWorld );
mBaseAddress = PixelPtr(::GetPixBaseAddr( thePix ));
mRowBytes = RowWidth((*thePix)->rowBytes & 0x1FFFL);
mBounds = bounds;
mBitDepth = depth;
mPort = CGrafPtr(mGWorld);
mGDevice = nil;
mAddressingMode = ::PixMap32Bit( thePix );
BuildQuickRow();
}
QDErr CDirectGWorld::NewCleanGWorld( GWorldPtr &theGWorld, Rect& bounds, BitDepth depth,
CTabHandle cTable )
{ CGrafPtr origPort;
GDHandle origDev;
::GetGWorld( &origPort, &origDev );
QDErr err = ::NewGWorld( &theGWorld, depth, &bounds, cTable, nil, 0 );
if( err == noErr )
{ ::SetGWorld( theGWorld, nil );
::LockPixels( ::GetGWorldPixMap( theGWorld ) ); // enable drawing in it
// clean it up
::ForeColor( blackColor );
::BackColor( whiteColor );
::ClipRect( &theGWorld->portRect );
::PaintRect( &theGWorld->portRect );
}
::SetGWorld( origPort, origDev );
return err;
}